﻿
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Collections.Generic;
using Microsoft.AspNetCore.Cors;
using Stock.Core;
using System.Linq;
using System.Net;

namespace Web.Controllers
{
    public class NetController : BaseApiController
    {

        public NetController()
        {
           
        }

        [HttpPost()]
        public void Send(string content)
        {
            NetManager.sendMsg(content);

        }

        [HttpGet()]
        public dynamic getClients()
        {

            var data = NetManager.clients.Select(a=>new {a.userid, ip  = (a.point as IPEndPoint).Address + ":" + (a.point as IPEndPoint).Port.ToString() });
            return data;
        }

       
    }
}
